package Demo2;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: homechen
 * Date: 2024-03-23
 * Time: 19:44
 */
public class Person {
    private String name;
    private int age;

    @Override
    public boolean equals(Object obj) {
        // 引用相等
        if (this == obj) {
            return true;
        }
        if (obj == null || obj.getClass() != getClass()) {
            return false;
        }
        Person other = (Person) obj;
        return this.age == other.age && this.name.equals(other.name); // equals 还是比较的是值
    }

    public static final String USERNAME = "唐晨";

    public static void main(String[] args) {
        try {
            // int result = divide(10, 0);
            // System.out.println("result " + result);
        } catch (ArithmeticException e) {
            e.printStackTrace();
        } finally {
            System.out.println("finally block executed");
        }
    }
}
